package thread;

import utils.UtilsKt;

public class MyThread extends Thread {

    @Override
    public void run() {
        try {
            Thread.sleep(1000);
            System.out.println("你好世界");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }


    public void printState() {
        String state = "";
        switch (getState()) {
            case NEW:
                state = "NEW";
                break;
            case RUNNABLE:
                state = "RUNNABLE";
                break;
            case BLOCKED:
                state = "BLOCKED";
                break;
            case WAITING:
                state = "WAITING";
                break;
            case TIMED_WAITING:
                state = "TIMED_WAITING";
                break;
            case TERMINATED:
                state = "TERMINATED";
                break;
        }
        UtilsKt.print(state);
    }
}
